Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenNetworkBoot: Add PXE and HTTP(S) Boot support #549

Closed
wants to merge 1 commit into from

Conversation

mikebeaton
Copy link
Contributor

@mikebeaton mikebeaton commented Aug 6, 2024

Addresses acidanthera/bugtracker#2386.

Supports launching PXE and HTTP(S) boot options from the OpenCore menu if these are supported by the underlying firmware, or by additional drivers loaded by OpenCore. Additionally supports loading .dmg files and their associated .chunklist files over HTTP(S) Boot, allowing macOS Recovery to be started over HTTP(S) Boot.

This includes some changes which could be separate commits:

  • cc @Goldfish64 I have changed EXTERNAL_SYSTEM, ExternalSystem, etc. naming from bb44e89 to UNMANAGED_BOOT, UnmanagedBoot, etc. - I was finding it hard to keep track of external tool, external OS and external system in our code, and I believe (hope) the suggested new naming accurately captures what that code (which I was adding to and modifying for HTTP/PXE boot) is for - so just wanted to check that this change looks okay to you!
  • cc @savvamitrofanov I have updated the work done in 7e69946 to add IPv6 and HTTPS support
  • I have added a UEFI/Unload config option to unload existing firmware drivers - because it was necessary in a few cases to unload an existing firmware driver before loading the standard EDK 2 one provided with OC (since e.g. vendor HttpBootDxe makes ours think it is already started, but vendor driver is trying to use vendor UI which we do not have, therefore causes only non-working (blank screen) HTTP Boot options; and/or can be that vendor HttpDxe is locked to https:// but user wants to use http://)

[LibraryClasses]
NULL|OpenCorePkg/Library/OcCompilerIntrinsicsLib/OcCompilerIntrinsicsLib.inf
NULL|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
Copy link
Contributor Author

@mikebeaton mikebeaton Aug 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @savvamitrofanov @vit9696 - I believe it is important to support HTTPS boot as well as HTTP boot, therefore we need to also ship TlsDxe. However this depends on CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf. We cannot just specify that library in the !if $(NETWORK_TLS_ENABLE) == TRUE code block further up in this file, because it conflicts with our OcCompilerIntrinsicsLib (they define some of the same symbols, not surprisingly), and our intrinsics library was set to be added to everything by this line.

I have currently changed to using the CryptoPkg intrinsics library for everything (currently, including OpenDuet), instead. All seems to work fine, AFAICT, but might possibly be running slower than necessary for the rest of the code (e.g. see here) (though it makes no visible change that I've noticed). Or might be other negatives I am not aware of.

We could try to update our intrinsics library to add the couple of functions which are missing for it to link with CryptoPkg (namely __bzero and __udivdi3, which show as missing for TlsDxe on the 32-bit build), but suspect this may be a bad idea (for similar reasons, i.e. is CryptoPkg intrinsics lib addressing e.g. any constant time security concerns which we do not otherwise need to be concerned with? (I don't think so?) Or is at anyway addressing compilation concerns which are important (as above), and which our intrinsics library doesn't otherwise need to address? I think so.).

We could instead change to adding our intrinsics library manually wherever it is actually needed, rather than globally; so that CryptoPkg intrinsics library can be used just in CryptoPkg without conflicting with ours.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed, will try modifying so that everything uses more or less our intrinsics lib, however updated with missing required functions, and moved as core library to MdePkg in audk.

@mikebeaton
Copy link
Contributor Author

mikebeaton commented Aug 6, 2024

@vit9696 - I have not (yet) implemented what we discussed, about loading a DMG file directly into an OC-format DMG ramdisk. I think this could be done by adding a protocol of ours, which would be understood by a new custom OpenHttpBootDxe.

Currently a DMG is loaded into contiguous memory by HttpBootDxe.efi, then transferred from there to a not-necessarily-contiguous OC DMG ramdisk. However, and as you suggested, reading directly to a not-necessarily-contiguous ramdisk of the right size will work faster, and on machines with considerably less RAM.

This would be something to be added later.

@mikebeaton mikebeaton force-pushed the network-boot branch 11 times, most recently from 75ca794 to 61f26b9 Compare August 9, 2024 09:45
@mikebeaton
Copy link
Contributor Author

Will need to update to take account of acidanthera/bugtracker#2421

@mikebeaton mikebeaton marked this pull request as draft August 10, 2024 09:14
@mikebeaton mikebeaton force-pushed the network-boot branch 3 times, most recently from 751bea5 to 3f66bb7 Compare August 11, 2024 15:54
@mikebeaton
Copy link
Contributor Author

Will need to update to take account of acidanthera/bugtracker#2421

Done and committed here. See also acidanthera/audk#66 .

@@ -160,7 +160,7 @@
UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
UefiDriverEntryPoint|OpenCorePkg/Library/OcDriverEntryPoint/UefiDriverEntryPoint.inf
UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
UefiHiiServicesLib|OpenCorePkg/Library/OcHiiServicesLib/OcHiiServicesLib.inf
Copy link
Contributor Author

@mikebeaton mikebeaton Aug 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suspect this is another change which makes sense anyway. Resolves same issue as in 13a1c62 - namely that the EDK 2 HiiServicesLib asserts when officially optional protocols are not present.

@mikebeaton mikebeaton force-pushed the network-boot branch 2 times, most recently from bb608d9 to f73dfc7 Compare August 12, 2024 10:56
@mikebeaton
Copy link
Contributor Author

Resolved various dependencies (HiiDatabase; plus another new edk2-stable202405 requirement, on Hash2 protocol) which were stopping HTTP Boot working on MacPro5,1. So now gets much further, and visibly starts HTTP Boot, but still won't actually load anything. Returns eventually, so not sure why not. Not sure if this will be easy to resolve or not. Also not quite sure whether to make OpenNetworkBoot Staging or Platform? Feel like it's useful (if you want network boot) and stable on non-Apple hardware, but a shame it won't currently work on Apple.

@mikebeaton mikebeaton force-pushed the network-boot branch 2 times, most recently from 666f952 to d699561 Compare August 12, 2024 12:48
@mikebeaton mikebeaton force-pushed the network-boot branch 2 times, most recently from 72cbd76 to 1eefd37 Compare August 13, 2024 05:16
@mikebeaton mikebeaton marked this pull request as ready for review August 13, 2024 21:04
@mikebeaton mikebeaton force-pushed the network-boot branch 3 times, most recently from 23521af to 0df44d0 Compare August 17, 2024 07:46
@mikebeaton
Copy link
Contributor Author

Also as discussed, I will convert the various separable supporting changes here to separate PRs.

@mikebeaton
Copy link
Contributor Author

Closing in favour of separated commits #552 #553 #554

@mikebeaton mikebeaton closed this Sep 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant